package com.waylau.netty.demo.rtmp;

import java.util.Iterator;
import java.util.Map.Entry;
import java.util.logging.Logger;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;

public class RTMPInboundHandlerAdapter<SocketChannel> extends ChannelInitializer<Channel> {
	private Logger logger = Logger.getLogger(getClass().getName());

	@Override
	protected void initChannel(Channel ch) throws Exception {
		ChannelPipeline chpl = ch.pipeline();
		Iterator<Entry<String, ChannelHandler>> it = chpl.iterator();
		Entry<String, ChannelHandler> entity = null;
		while (it.hasNext()) {
			entity = it.next();
			logger.info(entity.getValue().getClass().getName());
		}
		// ch.pipeline().addLast("decoder", new
		// ProtocolDecoder(MAX_FRAME_LENGTH, LENGTH_FIELD_OFFSET,
		// LENGTH_FIELD_LENGTH, LENGTH_ADJUSTMENT, INITIAL_BYTES_TO_STRIP));
		// ch.pipeline().addLast("encoder", new ProtocolEncoder());
		ch.pipeline().addLast(new RTMPServerHandler());
	}

}
